# -*- coding: utf-8 -*-
#
# GmAnt
# http://www.royalar.cn/2009/11/gmant
#
import re
import ConfigParser

#读取配置文件
def ReadConf():
    o={}
    cfg = ConfigParser.RawConfigParser()
    cfg.readfp(open('conf.ini'))
    o['save_dir'] = cfg.get('download','save_dir')
    o['file_name'] = cfg.get('download','file_name')
    return o


#转换unicode十进制编码
def Unicode2Str(str):
    m = re.findall('&#[\da-fA-F]{1,5};',str)
    if len(m) == 0 : return ''
    ret = ''
    for s in m:
        ret += unichr(int(s[2:-1]))
    return ret
    